| | | 1 | | // Copyright (c) 2020-2023 dotBunny Inc. |
| | | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | | 3 | | // See the LICENSE file in the project root for more information. |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using UnityEngine; |
| | | 7 | | |
| | | 8 | | namespace GDX.Data |
| | | 9 | | { |
| | | 10 | | public class SimpleTable : ScriptableObject |
| | | 11 | | { |
| | | 12 | | public enum ColumnType |
| | | 13 | | { |
| | | 14 | | Invalid = -1, |
| | | 15 | | String, |
| | | 16 | | Char, |
| | | 17 | | Bool, |
| | | 18 | | Sbyte, |
| | | 19 | | Byte, |
| | | 20 | | Short, |
| | | 21 | | Ushort, |
| | | 22 | | Int, |
| | | 23 | | Uint, |
| | | 24 | | Long, |
| | | 25 | | Ulong, |
| | | 26 | | Float, |
| | | 27 | | Double, |
| | | 28 | | Vector2, |
| | | 29 | | Vector3, |
| | | 30 | | Vector4, |
| | | 31 | | Vector2Int, |
| | | 32 | | Vector3Int, |
| | | 33 | | Quaternion, |
| | | 34 | | Rect, |
| | | 35 | | RectInt, |
| | | 36 | | Color, |
| | | 37 | | LayerMask, |
| | | 38 | | Bounds, |
| | | 39 | | BoundsInt, |
| | | 40 | | Hash128, |
| | | 41 | | Gradient, |
| | | 42 | | AnimationCurve, |
| | | 43 | | Object, |
| | | 44 | | Count |
| | | 45 | | } |
| | | 46 | | |
| | | 47 | | public struct ColumnEntry |
| | | 48 | | { |
| | | 49 | | public string Name; |
| | | 50 | | public int Id; |
| | | 51 | | public ColumnType Type; |
| | | 52 | | } |
| | | 53 | | internal struct ColumnEntryInternal |
| | | 54 | | { |
| | | 55 | | public ColumnType columnType; |
| | | 56 | | public int columnDenseIndex; |
| | | 57 | | } |
| | | 58 | | |
| | | 59 | | internal string[][] allStringColumns; |
| | | 60 | | internal bool[][] allBoolColumns; |
| | | 61 | | internal char[][] allCharColumns; |
| | | 62 | | internal sbyte[][] allSbyteColumns; |
| | | 63 | | internal byte[][] allByteColumns; |
| | | 64 | | internal short[][] allShortColumns; |
| | | 65 | | internal ushort[][] allUshortColumns; |
| | | 66 | | internal int[][] allIntColumns; |
| | | 67 | | internal uint[][] allUintColumns; |
| | | 68 | | internal long[][] allLongColumns; |
| | | 69 | | internal ulong[][] allUlongColumns; |
| | | 70 | | internal float[][] allFloatColumns; |
| | | 71 | | internal double[][] allDoubleColumns; |
| | | 72 | | internal Vector2[][] allVector2Columns; |
| | | 73 | | internal Vector3[][] allVector3Columns; |
| | | 74 | | internal Vector4[][] allVector4Columns; |
| | | 75 | | internal Vector2Int[][] allVector2IntColumns; |
| | | 76 | | internal Vector3Int[][] allVector3IntColumns; |
| | | 77 | | internal Quaternion[][] allQuaternionColumns; |
| | | 78 | | internal Rect[][] allRectColumns; |
| | | 79 | | internal RectInt[][] allRectIntColumns; |
| | | 80 | | internal Color[][] allColorColumns; |
| | | 81 | | internal LayerMask[][] allLayerMaskColumns; |
| | | 82 | | internal Bounds[][] allBoundsColumns; |
| | | 83 | | internal BoundsInt[][] allBoundsIntColumns; |
| | | 84 | | internal Hash128[][] allHash128Columns; |
| | | 85 | | internal Gradient[][] allGradientColumns; |
| | | 86 | | internal AnimationCurve[][] allAnimationCurveColumns; |
| | | 87 | | internal UnityEngine.Object[][] allObjectRefColumns; |
| | | 88 | | |
| | 0 | 89 | | internal string[][] allColumnNames = new string[(int)ColumnType.Count][]; // Contains the name of each column of |
| | 0 | 90 | | internal int[][] allColumnOrders = new int[(int)ColumnType.Count][]; // Contains the left-to-right order of each |
| | | 91 | | |
| | | 92 | | internal string[] allRowNames; |
| | | 93 | | internal int rowCount; |
| | | 94 | | |
| | | 95 | | internal ColumnEntryInternal[] columnIDToDenseIndexMap; |
| | 0 | 96 | | internal int[][] columnDenseIndexToIDMap = new int[(int)ColumnType.Count][]; |
| | | 97 | | internal int columnEntriesFreeListHead; |
| | | 98 | | |
| | | 99 | | internal int combinedColumnCount; |
| | 0 | 100 | | internal ulong dataVersion = 1; |
| | | 101 | | |
| | | 102 | | |
| | | 103 | | // BEGIN - View Hacks |
| | | 104 | | public int ColumnCount |
| | | 105 | | { |
| | | 106 | | get |
| | 0 | 107 | | { |
| | 0 | 108 | | return combinedColumnCount; |
| | 0 | 109 | | } |
| | | 110 | | } |
| | | 111 | | |
| | | 112 | | public int RowCount |
| | | 113 | | { |
| | | 114 | | get |
| | 0 | 115 | | { |
| | 0 | 116 | | return rowCount; |
| | 0 | 117 | | } |
| | | 118 | | } |
| | | 119 | | |
| | | 120 | | public ColumnEntry[] GetOrderedColumns() |
| | 0 | 121 | | { |
| | 0 | 122 | | if (combinedColumnCount == 0) return null; |
| | | 123 | | |
| | 0 | 124 | | int columnCount = (int)ColumnType.Count; |
| | 0 | 125 | | ColumnEntry[] returnArray = new ColumnEntry[combinedColumnCount]; |
| | | 126 | | |
| | 0 | 127 | | for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) |
| | 0 | 128 | | { |
| | 0 | 129 | | int[] columnOrders = allColumnOrders[columnIndex]; |
| | 0 | 130 | | int columnOrdersLength = columnOrders.Length; |
| | | 131 | | |
| | 0 | 132 | | int[] columnIndices = columnDenseIndexToIDMap[columnIndex]; |
| | 0 | 133 | | string[] columnNames = allColumnNames[columnIndex]; |
| | | 134 | | |
| | 0 | 135 | | for (int i = 0; i < columnOrdersLength; i++) |
| | 0 | 136 | | { |
| | 0 | 137 | | returnArray[columnOrders[i]] = new ColumnEntry |
| | | 138 | | { |
| | | 139 | | Name = columnNames[i], |
| | | 140 | | Id = columnIndices[i], |
| | | 141 | | Type = (ColumnType)columnIndex |
| | | 142 | | }; |
| | 0 | 143 | | } |
| | 0 | 144 | | } |
| | 0 | 145 | | return returnArray; |
| | 0 | 146 | | } |
| | | 147 | | |
| | | 148 | | |
| | | 149 | | // END - View Hacks |
| | | 150 | | |
| | | 151 | | // TODO: Way to set column name |
| | | 152 | | |
| | | 153 | | |
| | | 154 | | |
| | | 155 | | public void AddRow(string rowName = null, int insertAt = -1) |
| | 0 | 156 | | { |
| | 0 | 157 | | insertAt = insertAt < 0 ? rowCount : insertAt; |
| | | 158 | | |
| | 0 | 159 | | Array.Resize(ref allRowNames, rowCount + 1); |
| | 0 | 160 | | for (int i = rowCount; i > insertAt; i--) |
| | 0 | 161 | | { |
| | 0 | 162 | | allRowNames[i] = allRowNames[i - 1]; |
| | 0 | 163 | | } |
| | | 164 | | |
| | 0 | 165 | | rowName ??= string.Empty; |
| | 0 | 166 | | allRowNames[insertAt] = rowName; |
| | | 167 | | |
| | 0 | 168 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, 1); |
| | 0 | 169 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, 1); |
| | 0 | 170 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, 1); |
| | 0 | 171 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, 1); |
| | 0 | 172 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, 1); |
| | 0 | 173 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, 1); |
| | 0 | 174 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, 1); |
| | 0 | 175 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, 1); |
| | 0 | 176 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, 1); |
| | 0 | 177 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, 1); |
| | 0 | 178 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, 1); |
| | 0 | 179 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, 1); |
| | 0 | 180 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, 1); |
| | 0 | 181 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, 1); |
| | 0 | 182 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, 1); |
| | 0 | 183 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, 1); |
| | 0 | 184 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, 1); |
| | 0 | 185 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, 1); |
| | 0 | 186 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, 1); |
| | 0 | 187 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, 1); |
| | 0 | 188 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, 1); |
| | 0 | 189 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, 1); |
| | 0 | 190 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, 1); |
| | 0 | 191 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, 1); |
| | 0 | 192 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, 1); |
| | 0 | 193 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, 1); |
| | 0 | 194 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, 1); |
| | 0 | 195 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, 1); |
| | 0 | 196 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, 1); |
| | | 197 | | |
| | 0 | 198 | | ++rowCount; |
| | 0 | 199 | | dataVersion++; |
| | 0 | 200 | | } |
| | | 201 | | |
| | | 202 | | public void AddRows(int numberOfNewRows, string[] rowNames = null, int insertAt = -1) |
| | 0 | 203 | | { |
| | 0 | 204 | | insertAt = insertAt < 0 ? rowCount : insertAt; |
| | | 205 | | |
| | 0 | 206 | | Array.Resize(ref allRowNames, rowCount + 1); |
| | 0 | 207 | | for (int i = rowCount; i > insertAt; i--) |
| | 0 | 208 | | { |
| | 0 | 209 | | allRowNames[i] = allRowNames[i - 1]; |
| | 0 | 210 | | } |
| | | 211 | | |
| | 0 | 212 | | string empty = string.Empty; |
| | 0 | 213 | | int rowNamesLength = rowNames?.Length ?? 0; |
| | 0 | 214 | | for (int i = 0; i < rowNames.Length; i++) |
| | 0 | 215 | | { |
| | 0 | 216 | | string nameAt = rowNames[i]; |
| | 0 | 217 | | allRowNames[insertAt + i] = nameAt ?? empty; |
| | 0 | 218 | | } |
| | | 219 | | |
| | 0 | 220 | | for (int i = rowNamesLength; i < numberOfNewRows; i++) |
| | 0 | 221 | | { |
| | 0 | 222 | | allRowNames[insertAt + i] = empty; |
| | 0 | 223 | | } |
| | | 224 | | |
| | 0 | 225 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, numberOfNewRows); |
| | 0 | 226 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 227 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, numberOfNewRows); |
| | 0 | 228 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 229 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, numberOfNewRows); |
| | 0 | 230 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, numberOfNewRows); |
| | 0 | 231 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 232 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, numberOfNewRows); |
| | 0 | 233 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, numberOfNewRows); |
| | 0 | 234 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, numberOfNewRows); |
| | 0 | 235 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 236 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 237 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 238 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 239 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 240 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 241 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 242 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 243 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 244 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, numberOfNewRows); |
| | 0 | 245 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 246 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, numberOfNewRows); |
| | 0 | 247 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 248 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 249 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 250 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 251 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 252 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 253 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, numberOfNewRows); |
| | | 254 | | |
| | 0 | 255 | | rowCount += numberOfNewRows; |
| | 0 | 256 | | dataVersion++; |
| | 0 | 257 | | } |
| | | 258 | | |
| | | 259 | | public void RemoveRow(int removeAt) |
| | 0 | 260 | | { |
| | 0 | 261 | | int newRowCount = rowCount - 1; |
| | 0 | 262 | | for (int j = removeAt; j < newRowCount; j++) |
| | 0 | 263 | | { |
| | 0 | 264 | | allRowNames[j] = allRowNames[j + 1]; |
| | 0 | 265 | | } |
| | | 266 | | |
| | 0 | 267 | | Array.Resize(ref allRowNames, newRowCount); |
| | | 268 | | |
| | 0 | 269 | | DeleteRowsOfTypeInternal(ref allStringColumns, removeAt, 1); |
| | 0 | 270 | | DeleteRowsOfTypeInternal(ref allBoolColumns, removeAt, 1); |
| | 0 | 271 | | DeleteRowsOfTypeInternal(ref allCharColumns, removeAt, 1); |
| | 0 | 272 | | DeleteRowsOfTypeInternal(ref allSbyteColumns, removeAt, 1); |
| | 0 | 273 | | DeleteRowsOfTypeInternal(ref allByteColumns, removeAt, 1); |
| | 0 | 274 | | DeleteRowsOfTypeInternal(ref allShortColumns, removeAt, 1); |
| | 0 | 275 | | DeleteRowsOfTypeInternal(ref allUshortColumns, removeAt, 1); |
| | 0 | 276 | | DeleteRowsOfTypeInternal(ref allIntColumns, removeAt, 1); |
| | 0 | 277 | | DeleteRowsOfTypeInternal(ref allUintColumns, removeAt, 1); |
| | 0 | 278 | | DeleteRowsOfTypeInternal(ref allLongColumns, removeAt, 1); |
| | 0 | 279 | | DeleteRowsOfTypeInternal(ref allUlongColumns, removeAt, 1); |
| | 0 | 280 | | DeleteRowsOfTypeInternal(ref allFloatColumns, removeAt, 1); |
| | 0 | 281 | | DeleteRowsOfTypeInternal(ref allDoubleColumns, removeAt, 1); |
| | 0 | 282 | | DeleteRowsOfTypeInternal(ref allVector2Columns, removeAt, 1); |
| | 0 | 283 | | DeleteRowsOfTypeInternal(ref allVector3Columns, removeAt, 1); |
| | 0 | 284 | | DeleteRowsOfTypeInternal(ref allVector4Columns, removeAt, 1); |
| | 0 | 285 | | DeleteRowsOfTypeInternal(ref allVector2IntColumns, removeAt, 1); |
| | 0 | 286 | | DeleteRowsOfTypeInternal(ref allVector3IntColumns, removeAt, 1); |
| | 0 | 287 | | DeleteRowsOfTypeInternal(ref allQuaternionColumns, removeAt, 1); |
| | 0 | 288 | | DeleteRowsOfTypeInternal(ref allRectColumns, removeAt, 1); |
| | 0 | 289 | | DeleteRowsOfTypeInternal(ref allRectIntColumns, removeAt, 1); |
| | 0 | 290 | | DeleteRowsOfTypeInternal(ref allColorColumns, removeAt, 1); |
| | 0 | 291 | | DeleteRowsOfTypeInternal(ref allLayerMaskColumns, removeAt, 1); |
| | 0 | 292 | | DeleteRowsOfTypeInternal(ref allBoundsColumns, removeAt, 1); |
| | 0 | 293 | | DeleteRowsOfTypeInternal(ref allBoundsIntColumns, removeAt, 1); |
| | 0 | 294 | | DeleteRowsOfTypeInternal(ref allHash128Columns, removeAt, 1); |
| | 0 | 295 | | DeleteRowsOfTypeInternal(ref allGradientColumns, removeAt, 1); |
| | 0 | 296 | | DeleteRowsOfTypeInternal(ref allAnimationCurveColumns, removeAt, 1); |
| | 0 | 297 | | DeleteRowsOfTypeInternal(ref allObjectRefColumns, removeAt, 1); |
| | | 298 | | |
| | 0 | 299 | | --rowCount; |
| | 0 | 300 | | dataVersion++; |
| | 0 | 301 | | } |
| | | 302 | | |
| | | 303 | | public void RemoveRows(int removeAt, int numberOfRowsToDelete) |
| | 0 | 304 | | { |
| | 0 | 305 | | int newRowCount = rowCount - numberOfRowsToDelete; |
| | 0 | 306 | | for (int j = removeAt; j < rowCount - numberOfRowsToDelete; j++) |
| | 0 | 307 | | { |
| | 0 | 308 | | allRowNames[j] = allRowNames[j + numberOfRowsToDelete]; |
| | 0 | 309 | | } |
| | | 310 | | |
| | 0 | 311 | | Array.Resize(ref allRowNames, newRowCount); |
| | | 312 | | |
| | 0 | 313 | | DeleteRowsOfTypeInternal(ref allStringColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 314 | | DeleteRowsOfTypeInternal(ref allBoolColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 315 | | DeleteRowsOfTypeInternal(ref allCharColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 316 | | DeleteRowsOfTypeInternal(ref allSbyteColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 317 | | DeleteRowsOfTypeInternal(ref allByteColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 318 | | DeleteRowsOfTypeInternal(ref allShortColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 319 | | DeleteRowsOfTypeInternal(ref allUshortColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 320 | | DeleteRowsOfTypeInternal(ref allIntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 321 | | DeleteRowsOfTypeInternal(ref allUintColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 322 | | DeleteRowsOfTypeInternal(ref allLongColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 323 | | DeleteRowsOfTypeInternal(ref allUlongColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 324 | | DeleteRowsOfTypeInternal(ref allFloatColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 325 | | DeleteRowsOfTypeInternal(ref allDoubleColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 326 | | DeleteRowsOfTypeInternal(ref allVector2Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 327 | | DeleteRowsOfTypeInternal(ref allVector3Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 328 | | DeleteRowsOfTypeInternal(ref allVector4Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 329 | | DeleteRowsOfTypeInternal(ref allVector2IntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 330 | | DeleteRowsOfTypeInternal(ref allVector3IntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 331 | | DeleteRowsOfTypeInternal(ref allQuaternionColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 332 | | DeleteRowsOfTypeInternal(ref allRectColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 333 | | DeleteRowsOfTypeInternal(ref allRectIntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 334 | | DeleteRowsOfTypeInternal(ref allColorColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 335 | | DeleteRowsOfTypeInternal(ref allLayerMaskColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 336 | | DeleteRowsOfTypeInternal(ref allBoundsColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 337 | | DeleteRowsOfTypeInternal(ref allBoundsIntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 338 | | DeleteRowsOfTypeInternal(ref allHash128Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 339 | | DeleteRowsOfTypeInternal(ref allGradientColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 340 | | DeleteRowsOfTypeInternal(ref allAnimationCurveColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 341 | | DeleteRowsOfTypeInternal(ref allObjectRefColumns, removeAt, numberOfRowsToDelete); |
| | | 342 | | |
| | 0 | 343 | | rowCount -= numberOfRowsToDelete; |
| | 0 | 344 | | dataVersion++; |
| | 0 | 345 | | } |
| | | 346 | | |
| | | 347 | | // Add Column |
| | | 348 | | |
| | | 349 | | public int AddStringColumn(string columnName, int insertAt = -1) |
| | 0 | 350 | | { |
| | 0 | 351 | | return AddColumnInternal(columnName, ref allStringColumns, ColumnType.String, insertAt); |
| | 0 | 352 | | } |
| | | 353 | | |
| | | 354 | | public int AddBoolColumn(string columnName, int insertAt = -1) |
| | 0 | 355 | | { |
| | 0 | 356 | | return AddColumnInternal(columnName, ref allBoolColumns, ColumnType.Bool, insertAt); |
| | 0 | 357 | | } |
| | | 358 | | |
| | | 359 | | public int AddCharColumn(string columnName, int insertAt = -1) |
| | 0 | 360 | | { |
| | 0 | 361 | | return AddColumnInternal(columnName, ref allCharColumns, ColumnType.Char, insertAt); |
| | 0 | 362 | | } |
| | | 363 | | |
| | | 364 | | public int AddSbyteColumn(string columnName, int insertAt = -1) |
| | 0 | 365 | | { |
| | 0 | 366 | | return AddColumnInternal(columnName, ref allSbyteColumns, ColumnType.Sbyte, insertAt); |
| | 0 | 367 | | } |
| | | 368 | | |
| | | 369 | | public int AddByteColumn(string columnName, int insertAt = -1) |
| | 0 | 370 | | { |
| | 0 | 371 | | return AddColumnInternal(columnName, ref allByteColumns, ColumnType.Byte, insertAt); |
| | 0 | 372 | | } |
| | | 373 | | |
| | | 374 | | public int AddShortColumn(string columnName, int insertAt = -1) |
| | 0 | 375 | | { |
| | 0 | 376 | | return AddColumnInternal(columnName, ref allShortColumns, ColumnType.Short, insertAt); |
| | 0 | 377 | | } |
| | | 378 | | |
| | | 379 | | public int AddUshortColumn(string columnName, int insertAt = -1) |
| | 0 | 380 | | { |
| | 0 | 381 | | return AddColumnInternal(columnName, ref allUshortColumns, ColumnType.Ushort, insertAt); |
| | 0 | 382 | | } |
| | | 383 | | |
| | | 384 | | public int AddIntColumn(string columnName, int insertAt = -1) |
| | 0 | 385 | | { |
| | 0 | 386 | | return AddColumnInternal(columnName, ref allIntColumns, ColumnType.Int, insertAt); |
| | 0 | 387 | | } |
| | | 388 | | |
| | | 389 | | public int AddUintColumn(string columnName, int insertAt = -1) |
| | 0 | 390 | | { |
| | 0 | 391 | | return AddColumnInternal(columnName, ref allUintColumns, ColumnType.Uint, insertAt); |
| | 0 | 392 | | } |
| | | 393 | | |
| | | 394 | | public int AddLongColumn(string columnName, int insertAt = -1) |
| | 0 | 395 | | { |
| | 0 | 396 | | return AddColumnInternal(columnName, ref allLongColumns, ColumnType.Long, insertAt); |
| | 0 | 397 | | } |
| | | 398 | | |
| | | 399 | | public int AddUlongColumn(string columnName, int insertAt = -1) |
| | 0 | 400 | | { |
| | 0 | 401 | | return AddColumnInternal(columnName, ref allUlongColumns, ColumnType.Ulong, insertAt); |
| | 0 | 402 | | } |
| | | 403 | | |
| | | 404 | | public int AddFloatColumn(string columnName, int insertAt = -1) |
| | 0 | 405 | | { |
| | 0 | 406 | | return AddColumnInternal(columnName, ref allFloatColumns, ColumnType.Float, insertAt); |
| | 0 | 407 | | } |
| | | 408 | | |
| | | 409 | | public int AddDoubleColumn(string columnName, int insertAt = -1) |
| | 0 | 410 | | { |
| | 0 | 411 | | return AddColumnInternal(columnName, ref allDoubleColumns, ColumnType.Double, insertAt); |
| | 0 | 412 | | } |
| | | 413 | | |
| | | 414 | | public int AddVector2Column(string columnName, int insertAt = -1) |
| | 0 | 415 | | { |
| | 0 | 416 | | return AddColumnInternal(columnName, ref allVector2Columns, ColumnType.Vector2, insertAt); |
| | 0 | 417 | | } |
| | | 418 | | |
| | | 419 | | public int AddVector3Column(string columnName, int insertAt = -1) |
| | 0 | 420 | | { |
| | 0 | 421 | | return AddColumnInternal(columnName, ref allVector3Columns, ColumnType.Vector3, insertAt); |
| | 0 | 422 | | } |
| | | 423 | | |
| | | 424 | | public int AddVector4Column(string columnName, int insertAt = -1) |
| | 0 | 425 | | { |
| | 0 | 426 | | return AddColumnInternal(columnName, ref allVector4Columns, ColumnType.Vector4, insertAt); |
| | 0 | 427 | | } |
| | | 428 | | |
| | | 429 | | public int AddVector2IntColumn(string columnName, int insertAt = -1) |
| | 0 | 430 | | { |
| | 0 | 431 | | return AddColumnInternal(columnName, ref allVector2IntColumns, ColumnType.Vector2Int, insertAt); |
| | 0 | 432 | | } |
| | | 433 | | |
| | | 434 | | public int AddVector3IntColumn(string columnName, int insertAt = -1) |
| | 0 | 435 | | { |
| | 0 | 436 | | return AddColumnInternal(columnName, ref allVector3IntColumns, ColumnType.Vector3Int, insertAt); |
| | 0 | 437 | | } |
| | | 438 | | |
| | | 439 | | public int AddQuaternionColumn(string columnName, int insertAt = -1) |
| | 0 | 440 | | { |
| | 0 | 441 | | return AddColumnInternal(columnName, ref allQuaternionColumns, ColumnType.Quaternion, insertAt); |
| | 0 | 442 | | } |
| | | 443 | | |
| | | 444 | | public int AddRectColumn(string columnName, int insertAt = -1) |
| | 0 | 445 | | { |
| | 0 | 446 | | return AddColumnInternal(columnName, ref allRectColumns, ColumnType.Rect, insertAt); |
| | 0 | 447 | | } |
| | | 448 | | |
| | | 449 | | public int AddRectIntColumn(string columnName, int insertAt = -1) |
| | 0 | 450 | | { |
| | 0 | 451 | | return AddColumnInternal(columnName, ref allRectIntColumns, ColumnType.RectInt, insertAt); |
| | 0 | 452 | | } |
| | | 453 | | |
| | | 454 | | public int AddColorColumn(string columnName, int insertAt = -1) |
| | 0 | 455 | | { |
| | 0 | 456 | | return AddColumnInternal(columnName, ref allColorColumns, ColumnType.Color, insertAt); |
| | 0 | 457 | | } |
| | | 458 | | |
| | | 459 | | public int AddLayerMaskColumn(string columnName, int insertAt = -1) |
| | 0 | 460 | | { |
| | 0 | 461 | | return AddColumnInternal(columnName, ref allLayerMaskColumns, ColumnType.LayerMask, insertAt); |
| | 0 | 462 | | } |
| | | 463 | | |
| | | 464 | | public int AddBoundsColumn(string columnName, int insertAt = -1) |
| | 0 | 465 | | { |
| | 0 | 466 | | return AddColumnInternal(columnName, ref allBoundsColumns, ColumnType.Bounds, insertAt); |
| | 0 | 467 | | } |
| | | 468 | | |
| | | 469 | | public int AddBoundsIntColumn(string columnName, int insertAt = -1) |
| | 0 | 470 | | { |
| | 0 | 471 | | return AddColumnInternal(columnName, ref allBoundsIntColumns, ColumnType.BoundsInt, insertAt); |
| | 0 | 472 | | } |
| | | 473 | | |
| | | 474 | | public int AddHash128Column(string columnName, int insertAt = -1) |
| | 0 | 475 | | { |
| | 0 | 476 | | return AddColumnInternal(columnName, ref allHash128Columns, ColumnType.Hash128, insertAt); |
| | 0 | 477 | | } |
| | | 478 | | |
| | | 479 | | public int AddGradientColumn(string columnName, int insertAt = -1) |
| | 0 | 480 | | { |
| | 0 | 481 | | return AddColumnInternal(columnName, ref allGradientColumns, ColumnType.Gradient, insertAt); |
| | 0 | 482 | | } |
| | | 483 | | |
| | | 484 | | public int AddAnimationCurveColumn(string columnName, int insertAt = -1) |
| | 0 | 485 | | { |
| | 0 | 486 | | return AddColumnInternal(columnName, ref allAnimationCurveColumns, ColumnType.AnimationCurve, insertAt); |
| | 0 | 487 | | } |
| | | 488 | | |
| | | 489 | | public int AddObjectColumn(string columnName, int insertAt = -1) |
| | 0 | 490 | | { |
| | 0 | 491 | | return AddColumnInternal(columnName, ref allObjectRefColumns, ColumnType.Object, insertAt); |
| | 0 | 492 | | } |
| | | 493 | | |
| | | 494 | | // Remove Column |
| | | 495 | | |
| | | 496 | | public void RemoveStringColumn(int removeAt) |
| | 0 | 497 | | { |
| | 0 | 498 | | RemoveColumnInternal(ref allStringColumns, ColumnType.String, removeAt); |
| | 0 | 499 | | } |
| | | 500 | | |
| | | 501 | | public void RemoveBoolColumn(int removeAt) |
| | 0 | 502 | | { |
| | 0 | 503 | | RemoveColumnInternal(ref allBoolColumns, ColumnType.Bool, removeAt); |
| | 0 | 504 | | } |
| | | 505 | | |
| | | 506 | | public void RemoveCharColumn(int removeAt) |
| | 0 | 507 | | { |
| | 0 | 508 | | RemoveColumnInternal(ref allCharColumns, ColumnType.Char, removeAt); |
| | 0 | 509 | | } |
| | | 510 | | |
| | | 511 | | public void RemoveSbyteColumn(int removeAt) |
| | 0 | 512 | | { |
| | 0 | 513 | | RemoveColumnInternal(ref allSbyteColumns, ColumnType.Sbyte, removeAt); |
| | 0 | 514 | | } |
| | | 515 | | |
| | | 516 | | public void RemoveByteColumn(int removeAt) |
| | 0 | 517 | | { |
| | 0 | 518 | | RemoveColumnInternal(ref allByteColumns, ColumnType.Byte, removeAt); |
| | 0 | 519 | | } |
| | | 520 | | |
| | | 521 | | public void RemoveShortColumn(int removeAt) |
| | 0 | 522 | | { |
| | 0 | 523 | | RemoveColumnInternal(ref allShortColumns, ColumnType.Short, removeAt); |
| | 0 | 524 | | } |
| | | 525 | | |
| | | 526 | | public void RemoveUshortColumn(int removeAt) |
| | 0 | 527 | | { |
| | 0 | 528 | | RemoveColumnInternal(ref allUshortColumns, ColumnType.Ushort, removeAt); |
| | 0 | 529 | | } |
| | | 530 | | |
| | | 531 | | public void RemoveIntColumn(int removeAt) |
| | 0 | 532 | | { |
| | 0 | 533 | | RemoveColumnInternal(ref allIntColumns, ColumnType.Int, removeAt); |
| | 0 | 534 | | } |
| | | 535 | | |
| | | 536 | | public void RemoveUintColumn(int removeAt) |
| | 0 | 537 | | { |
| | 0 | 538 | | RemoveColumnInternal(ref allUintColumns, ColumnType.Uint, removeAt); |
| | 0 | 539 | | } |
| | | 540 | | |
| | | 541 | | public void RemoveLongColumn(int removeAt) |
| | 0 | 542 | | { |
| | 0 | 543 | | RemoveColumnInternal(ref allLongColumns, ColumnType.Long, removeAt); |
| | 0 | 544 | | } |
| | | 545 | | |
| | | 546 | | public void RemoveUlongColumn(int removeAt) |
| | 0 | 547 | | { |
| | 0 | 548 | | RemoveColumnInternal(ref allUlongColumns, ColumnType.Ulong, removeAt); |
| | 0 | 549 | | } |
| | | 550 | | |
| | | 551 | | public void RemoveFloatColumn(int removeAt) |
| | 0 | 552 | | { |
| | 0 | 553 | | RemoveColumnInternal(ref allFloatColumns, ColumnType.Float, removeAt); |
| | 0 | 554 | | } |
| | | 555 | | |
| | | 556 | | public void RemoveDoubleColumn(int removeAt) |
| | 0 | 557 | | { |
| | 0 | 558 | | RemoveColumnInternal(ref allDoubleColumns, ColumnType.Double, removeAt); |
| | 0 | 559 | | } |
| | | 560 | | |
| | | 561 | | public void RemoveVector2Column(int removeAt) |
| | 0 | 562 | | { |
| | 0 | 563 | | RemoveColumnInternal(ref allVector2Columns, ColumnType.Vector2, removeAt); |
| | 0 | 564 | | } |
| | | 565 | | |
| | | 566 | | public void RemoveVector3Column(int removeAt) |
| | 0 | 567 | | { |
| | 0 | 568 | | RemoveColumnInternal(ref allVector3Columns, ColumnType.Vector3, removeAt); |
| | 0 | 569 | | } |
| | | 570 | | |
| | | 571 | | public void RemoveVector4Column(int removeAt) |
| | 0 | 572 | | { |
| | 0 | 573 | | RemoveColumnInternal(ref allVector4Columns, ColumnType.Vector4, removeAt); |
| | 0 | 574 | | } |
| | | 575 | | |
| | | 576 | | public void RemoveVector2IntColumn(int removeAt) |
| | 0 | 577 | | { |
| | 0 | 578 | | RemoveColumnInternal(ref allVector2IntColumns, ColumnType.Vector2Int, removeAt); |
| | 0 | 579 | | } |
| | | 580 | | |
| | | 581 | | public void RemoveVector3IntColumn(int removeAt) |
| | 0 | 582 | | { |
| | 0 | 583 | | RemoveColumnInternal(ref allVector3IntColumns, ColumnType.Vector3Int, removeAt); |
| | 0 | 584 | | } |
| | | 585 | | |
| | | 586 | | public void RemoveQuaternionColumn(int removeAt) |
| | 0 | 587 | | { |
| | 0 | 588 | | RemoveColumnInternal(ref allQuaternionColumns, ColumnType.Quaternion, removeAt); |
| | 0 | 589 | | } |
| | | 590 | | |
| | | 591 | | public void RemoveRectColumn(int removeAt) |
| | 0 | 592 | | { |
| | 0 | 593 | | RemoveColumnInternal(ref allRectColumns, ColumnType.Rect, removeAt); |
| | 0 | 594 | | } |
| | | 595 | | |
| | | 596 | | public void RemoveRectIntColumn(int removeAt) |
| | 0 | 597 | | { |
| | 0 | 598 | | RemoveColumnInternal(ref allRectIntColumns, ColumnType.RectInt, removeAt); |
| | 0 | 599 | | } |
| | | 600 | | |
| | | 601 | | public void RemoveColorColumn(int removeAt) |
| | 0 | 602 | | { |
| | 0 | 603 | | RemoveColumnInternal(ref allColorColumns, ColumnType.Color, removeAt); |
| | 0 | 604 | | } |
| | | 605 | | |
| | | 606 | | public void RemoveLayerMaskColumn(int removeAt) |
| | 0 | 607 | | { |
| | 0 | 608 | | RemoveColumnInternal(ref allLayerMaskColumns, ColumnType.LayerMask, removeAt); |
| | 0 | 609 | | } |
| | | 610 | | |
| | | 611 | | public void RemoveBoundsColumn(int removeAt) |
| | 0 | 612 | | { |
| | 0 | 613 | | RemoveColumnInternal(ref allBoundsColumns, ColumnType.Bounds, removeAt); |
| | 0 | 614 | | } |
| | | 615 | | |
| | | 616 | | public void RemoveBoundsIntColumn(int removeAt) |
| | 0 | 617 | | { |
| | 0 | 618 | | RemoveColumnInternal(ref allBoundsIntColumns, ColumnType.BoundsInt, removeAt); |
| | 0 | 619 | | } |
| | | 620 | | |
| | | 621 | | public void RemoveHash128Column(int removeAt) |
| | 0 | 622 | | { |
| | 0 | 623 | | RemoveColumnInternal(ref allHash128Columns, ColumnType.Hash128, removeAt); |
| | 0 | 624 | | } |
| | | 625 | | |
| | | 626 | | public void RemoveGradientColumn(int removeAt) |
| | 0 | 627 | | { |
| | 0 | 628 | | RemoveColumnInternal(ref allGradientColumns, ColumnType.Gradient, removeAt); |
| | 0 | 629 | | } |
| | | 630 | | |
| | | 631 | | public void RemoveAnimationCurveColumn(int removeAt) |
| | 0 | 632 | | { |
| | 0 | 633 | | RemoveColumnInternal(ref allAnimationCurveColumns, ColumnType.AnimationCurve, removeAt); |
| | 0 | 634 | | } |
| | | 635 | | |
| | | 636 | | public void RemoveObjectColumn(int removeAt) |
| | 0 | 637 | | { |
| | 0 | 638 | | RemoveColumnInternal(ref allObjectRefColumns, ColumnType.Object, removeAt); |
| | 0 | 639 | | } |
| | | 640 | | |
| | | 641 | | // Set |
| | | 642 | | |
| | | 643 | | public void SetString(int row, int columnID, string value) |
| | 0 | 644 | | { |
| | 0 | 645 | | SetCell(row, columnID, ref allStringColumns, value); |
| | 0 | 646 | | } |
| | | 647 | | |
| | | 648 | | public void SetBool(int row, int columnID, bool value) |
| | 0 | 649 | | { |
| | 0 | 650 | | SetCell(row, columnID, ref allBoolColumns, value); |
| | 0 | 651 | | } |
| | | 652 | | |
| | | 653 | | public void SetChar(int row, int columnID, char value) |
| | 0 | 654 | | { |
| | 0 | 655 | | SetCell(row, columnID, ref allCharColumns, value); |
| | 0 | 656 | | } |
| | | 657 | | |
| | | 658 | | public void SetSbyte(int row, int columnID, sbyte value) |
| | 0 | 659 | | { |
| | 0 | 660 | | SetCell(row, columnID, ref allSbyteColumns, value); |
| | 0 | 661 | | } |
| | | 662 | | |
| | | 663 | | public void SetByte(int row, int columnID, byte value) |
| | 0 | 664 | | { |
| | 0 | 665 | | SetCell(row, columnID, ref allByteColumns, value); |
| | 0 | 666 | | } |
| | | 667 | | |
| | | 668 | | public void SetShort(int row, int columnID, short value) |
| | 0 | 669 | | { |
| | 0 | 670 | | SetCell(row, columnID, ref allShortColumns, value); |
| | 0 | 671 | | } |
| | | 672 | | |
| | | 673 | | public void SetUshort(int row, int columnID, ushort value) |
| | 0 | 674 | | { |
| | 0 | 675 | | SetCell(row, columnID, ref allUshortColumns, value); |
| | 0 | 676 | | } |
| | | 677 | | |
| | | 678 | | public void SetInt(int row, int columnID, int value) |
| | 0 | 679 | | { |
| | 0 | 680 | | SetCell(row, columnID, ref allIntColumns, value); |
| | 0 | 681 | | } |
| | | 682 | | |
| | | 683 | | public void SetUint(int row, int columnID, uint value) |
| | 0 | 684 | | { |
| | 0 | 685 | | SetCell(row, columnID, ref allUintColumns, value); |
| | 0 | 686 | | } |
| | | 687 | | |
| | | 688 | | public void SetLong(int row, int columnID, long value) |
| | 0 | 689 | | { |
| | 0 | 690 | | SetCell(row, columnID, ref allLongColumns, value); |
| | 0 | 691 | | } |
| | | 692 | | |
| | | 693 | | public void SetUlong(int row, int columnID, ulong value) |
| | 0 | 694 | | { |
| | 0 | 695 | | SetCell(row, columnID, ref allUlongColumns, value); |
| | 0 | 696 | | } |
| | | 697 | | |
| | | 698 | | public void SetFloat(int row, int columnID, float value) |
| | 0 | 699 | | { |
| | 0 | 700 | | SetCell(row, columnID, ref allFloatColumns, value); |
| | 0 | 701 | | } |
| | | 702 | | |
| | | 703 | | public void SetDouble(int row, int columnID, double value) |
| | 0 | 704 | | { |
| | 0 | 705 | | SetCell(row, columnID, ref allDoubleColumns, value); |
| | 0 | 706 | | } |
| | | 707 | | |
| | | 708 | | public void SetVector2(int row, int columnID, Vector2 value) |
| | 0 | 709 | | { |
| | 0 | 710 | | SetCell(row, columnID, ref allVector2Columns, value); |
| | 0 | 711 | | } |
| | | 712 | | |
| | | 713 | | public void SetVector3(int row, int columnID, Vector3 value) |
| | 0 | 714 | | { |
| | 0 | 715 | | SetCell(row, columnID, ref allVector3Columns, value); |
| | 0 | 716 | | } |
| | | 717 | | |
| | | 718 | | public void SetVector4(int row, int columnID, Vector4 value) |
| | 0 | 719 | | { |
| | 0 | 720 | | SetCell(row, columnID, ref allVector4Columns, value); |
| | 0 | 721 | | } |
| | | 722 | | |
| | | 723 | | public void SetVector2Int(int row, int columnID, Vector2Int value) |
| | 0 | 724 | | { |
| | 0 | 725 | | SetCell(row, columnID, ref allVector2IntColumns, value); |
| | 0 | 726 | | } |
| | | 727 | | |
| | | 728 | | public void SetVector3Int(int row, int columnID, Vector3Int value) |
| | 0 | 729 | | { |
| | 0 | 730 | | SetCell(row, columnID, ref allVector3IntColumns, value); |
| | 0 | 731 | | } |
| | | 732 | | |
| | | 733 | | public void SetQuaternion(int row, int columnID, Quaternion value) |
| | 0 | 734 | | { |
| | 0 | 735 | | SetCell(row, columnID, ref allQuaternionColumns, value); |
| | 0 | 736 | | } |
| | | 737 | | |
| | | 738 | | public void SetRect(int row, int columnID, Rect value) |
| | 0 | 739 | | { |
| | 0 | 740 | | SetCell(row, columnID, ref allRectColumns, value); |
| | 0 | 741 | | } |
| | | 742 | | |
| | | 743 | | public void SetRectInt(int row, int columnID, RectInt value) |
| | 0 | 744 | | { |
| | 0 | 745 | | SetCell(row, columnID, ref allRectIntColumns, value); |
| | 0 | 746 | | } |
| | | 747 | | |
| | | 748 | | public void SetColor(int row, int columnID, Color value) |
| | 0 | 749 | | { |
| | 0 | 750 | | SetCell(row, columnID, ref allColorColumns, value); |
| | 0 | 751 | | } |
| | | 752 | | |
| | | 753 | | public void SetLayerMask(int row, int columnID, LayerMask value) |
| | 0 | 754 | | { |
| | 0 | 755 | | SetCell(row, columnID, ref allLayerMaskColumns, value); |
| | 0 | 756 | | } |
| | | 757 | | |
| | | 758 | | public void SetBounds(int row, int columnID, Bounds value) |
| | 0 | 759 | | { |
| | 0 | 760 | | SetCell(row, columnID, ref allBoundsColumns, value); |
| | 0 | 761 | | } |
| | | 762 | | |
| | | 763 | | public void SetBoundsInt(int row, int columnID, BoundsInt value) |
| | 0 | 764 | | { |
| | 0 | 765 | | SetCell(row, columnID, ref allBoundsIntColumns, value); |
| | 0 | 766 | | } |
| | | 767 | | |
| | | 768 | | public void SetHash128(int row, int columnID, Hash128 value) |
| | 0 | 769 | | { |
| | 0 | 770 | | SetCell(row, columnID, ref allHash128Columns, value); |
| | 0 | 771 | | } |
| | | 772 | | |
| | | 773 | | public void SetGradient(int row, int columnID, Gradient value) |
| | 0 | 774 | | { |
| | 0 | 775 | | SetCell(row, columnID, ref allGradientColumns, value); |
| | 0 | 776 | | } |
| | | 777 | | |
| | | 778 | | public void SetAnimationCurve(int row, int columnID, AnimationCurve value) |
| | 0 | 779 | | { |
| | 0 | 780 | | SetCell(row, columnID, ref allAnimationCurveColumns, value); |
| | 0 | 781 | | } |
| | | 782 | | |
| | | 783 | | public void SetObject(int row, int columnID, UnityEngine.Object value) |
| | 0 | 784 | | { |
| | 0 | 785 | | SetCell(row, columnID, ref allObjectRefColumns, value); |
| | 0 | 786 | | } |
| | | 787 | | |
| | | 788 | | // Get |
| | | 789 | | |
| | | 790 | | public string GetString(int row, int columnID) |
| | 0 | 791 | | { |
| | 0 | 792 | | return GetCell(row, columnID, ref allStringColumns); |
| | 0 | 793 | | } |
| | | 794 | | |
| | | 795 | | public bool GetBool(int row, int columnID) |
| | 0 | 796 | | { |
| | 0 | 797 | | return GetCell(row, columnID, ref allBoolColumns); |
| | 0 | 798 | | } |
| | | 799 | | |
| | | 800 | | public char GetChar(int row, int columnID) |
| | 0 | 801 | | { |
| | 0 | 802 | | return GetCell(row, columnID, ref allCharColumns); |
| | 0 | 803 | | } |
| | | 804 | | |
| | | 805 | | public sbyte GetSbyte(int row, int columnID) |
| | 0 | 806 | | { |
| | 0 | 807 | | return GetCell(row, columnID, ref allSbyteColumns); |
| | 0 | 808 | | } |
| | | 809 | | |
| | | 810 | | public byte GetByte(int row, int columnID) |
| | 0 | 811 | | { |
| | 0 | 812 | | return GetCell(row, columnID, ref allByteColumns); |
| | 0 | 813 | | } |
| | | 814 | | |
| | | 815 | | public short GetShort(int row, int columnID) |
| | 0 | 816 | | { |
| | 0 | 817 | | return GetCell(row, columnID, ref allShortColumns); |
| | 0 | 818 | | } |
| | | 819 | | |
| | | 820 | | public ushort GetUshort(int row, int columnID) |
| | 0 | 821 | | { |
| | 0 | 822 | | return GetCell(row, columnID, ref allUshortColumns); |
| | 0 | 823 | | } |
| | | 824 | | |
| | | 825 | | public int GetInt(int row, int columnID) |
| | 0 | 826 | | { |
| | 0 | 827 | | return GetCell(row, columnID, ref allIntColumns); |
| | 0 | 828 | | } |
| | | 829 | | |
| | | 830 | | public uint GetUint(int row, int columnID) |
| | 0 | 831 | | { |
| | 0 | 832 | | return GetCell(row, columnID, ref allUintColumns); |
| | 0 | 833 | | } |
| | | 834 | | |
| | | 835 | | public long GetLong(int row, int columnID) |
| | 0 | 836 | | { |
| | 0 | 837 | | return GetCell(row, columnID, ref allLongColumns); |
| | 0 | 838 | | } |
| | | 839 | | |
| | | 840 | | public ulong GetUlong(int row, int columnID) |
| | 0 | 841 | | { |
| | 0 | 842 | | return GetCell(row, columnID, ref allUlongColumns); |
| | 0 | 843 | | } |
| | | 844 | | |
| | | 845 | | public float GetFloat(int row, int columnID) |
| | 0 | 846 | | { |
| | 0 | 847 | | return GetCell(row, columnID, ref allFloatColumns); |
| | 0 | 848 | | } |
| | | 849 | | |
| | | 850 | | public double GetDouble(int row, int columnID) |
| | 0 | 851 | | { |
| | 0 | 852 | | return GetCell(row, columnID, ref allDoubleColumns); |
| | 0 | 853 | | } |
| | | 854 | | |
| | | 855 | | public Vector2 GetVector2(int row, int columnID) |
| | 0 | 856 | | { |
| | 0 | 857 | | return GetCell(row, columnID, ref allVector2Columns); |
| | 0 | 858 | | } |
| | | 859 | | |
| | | 860 | | public Vector3 GetVector3(int row, int columnID) |
| | 0 | 861 | | { |
| | 0 | 862 | | return GetCell(row, columnID, ref allVector3Columns); |
| | 0 | 863 | | } |
| | | 864 | | |
| | | 865 | | public Vector4 GetVector4(int row, int columnID) |
| | 0 | 866 | | { |
| | 0 | 867 | | return GetCell(row, columnID, ref allVector4Columns); |
| | 0 | 868 | | } |
| | | 869 | | |
| | | 870 | | public Vector2Int GetVector2Int(int row, int columnID) |
| | 0 | 871 | | { |
| | 0 | 872 | | return GetCell(row, columnID, ref allVector2IntColumns); |
| | 0 | 873 | | } |
| | | 874 | | |
| | | 875 | | public Vector3Int GetVector3Int(int row, int columnID) |
| | 0 | 876 | | { |
| | 0 | 877 | | return GetCell(row, columnID, ref allVector3IntColumns); |
| | 0 | 878 | | } |
| | | 879 | | |
| | | 880 | | public Quaternion GetQuaternion(int row, int columnID) |
| | 0 | 881 | | { |
| | 0 | 882 | | return GetCell(row, columnID, ref allQuaternionColumns); |
| | 0 | 883 | | } |
| | | 884 | | |
| | | 885 | | public Rect GetRect(int row, int columnID) |
| | 0 | 886 | | { |
| | 0 | 887 | | return GetCell(row, columnID, ref allRectColumns); |
| | 0 | 888 | | } |
| | | 889 | | |
| | | 890 | | public RectInt GetRectInt(int row, int columnID) |
| | 0 | 891 | | { |
| | 0 | 892 | | return GetCell(row, columnID, ref allRectIntColumns); |
| | 0 | 893 | | } |
| | | 894 | | |
| | | 895 | | public Color GetColor(int row, int columnID) |
| | 0 | 896 | | { |
| | 0 | 897 | | return GetCell(row, columnID, ref allColorColumns); |
| | 0 | 898 | | } |
| | | 899 | | |
| | | 900 | | public LayerMask GetLayerMask(int row, int columnID) |
| | 0 | 901 | | { |
| | 0 | 902 | | return GetCell(row, columnID, ref allLayerMaskColumns); |
| | 0 | 903 | | } |
| | | 904 | | |
| | | 905 | | public Bounds GetBounds(int row, int columnID) |
| | 0 | 906 | | { |
| | 0 | 907 | | return GetCell(row, columnID, ref allBoundsColumns); |
| | 0 | 908 | | } |
| | | 909 | | |
| | | 910 | | public BoundsInt GetBoundsInt(int row, int columnID) |
| | 0 | 911 | | { |
| | 0 | 912 | | return GetCell(row, columnID, ref allBoundsIntColumns); |
| | 0 | 913 | | } |
| | | 914 | | |
| | | 915 | | public Hash128 GetHash128(int row, int columnID) |
| | 0 | 916 | | { |
| | 0 | 917 | | return GetCell(row, columnID, ref allHash128Columns); |
| | 0 | 918 | | } |
| | | 919 | | |
| | | 920 | | public Gradient GetGradient(int row, int columnID) |
| | 0 | 921 | | { |
| | 0 | 922 | | return GetCell(row, columnID, ref allGradientColumns); |
| | 0 | 923 | | } |
| | | 924 | | |
| | | 925 | | public AnimationCurve GetAnimationCurve(int row, int columnID) |
| | 0 | 926 | | { |
| | 0 | 927 | | return GetCell(row, columnID, ref allAnimationCurveColumns); |
| | 0 | 928 | | } |
| | | 929 | | |
| | | 930 | | public UnityEngine.Object GetObject(int row, int columnID) |
| | 0 | 931 | | { |
| | 0 | 932 | | return GetCell(row, columnID, ref allObjectRefColumns); |
| | 0 | 933 | | } |
| | | 934 | | |
| | | 935 | | // Get ref |
| | | 936 | | |
| | | 937 | | public ref string GetStringRef(int row, int columnID) |
| | 0 | 938 | | { |
| | 0 | 939 | | return ref GetCellRef(row, columnID, ref allStringColumns); |
| | 0 | 940 | | } |
| | | 941 | | |
| | | 942 | | public ref bool GetBoolRef(int row, int columnID) |
| | 0 | 943 | | { |
| | 0 | 944 | | return ref GetCellRef(row, columnID, ref allBoolColumns); |
| | 0 | 945 | | } |
| | | 946 | | |
| | | 947 | | public ref char GetCharRef(int row, int columnID) |
| | 0 | 948 | | { |
| | 0 | 949 | | return ref GetCellRef(row, columnID, ref allCharColumns); |
| | 0 | 950 | | } |
| | | 951 | | |
| | | 952 | | public ref sbyte GetSbyteRef(int row, int columnID) |
| | 0 | 953 | | { |
| | 0 | 954 | | return ref GetCellRef(row, columnID, ref allSbyteColumns); |
| | 0 | 955 | | } |
| | | 956 | | |
| | | 957 | | public ref byte GetByteRef(int row, int columnID) |
| | 0 | 958 | | { |
| | 0 | 959 | | return ref GetCellRef(row, columnID, ref allByteColumns); |
| | 0 | 960 | | } |
| | | 961 | | |
| | | 962 | | public ref short GetShortRef(int row, int columnID) |
| | 0 | 963 | | { |
| | 0 | 964 | | return ref GetCellRef(row, columnID, ref allShortColumns); |
| | 0 | 965 | | } |
| | | 966 | | |
| | | 967 | | public ref ushort GetUshortRef(int row, int columnID) |
| | 0 | 968 | | { |
| | 0 | 969 | | return ref GetCellRef(row, columnID, ref allUshortColumns); |
| | 0 | 970 | | } |
| | | 971 | | |
| | | 972 | | public ref int GetIntRef(int row, int columnID) |
| | 0 | 973 | | { |
| | 0 | 974 | | return ref GetCellRef(row, columnID, ref allIntColumns); |
| | 0 | 975 | | } |
| | | 976 | | |
| | | 977 | | public ref uint GetUintRef(int row, int columnID) |
| | 0 | 978 | | { |
| | 0 | 979 | | return ref GetCellRef(row, columnID, ref allUintColumns); |
| | 0 | 980 | | } |
| | | 981 | | |
| | | 982 | | public ref long GetLongRef(int row, int columnID) |
| | 0 | 983 | | { |
| | 0 | 984 | | return ref GetCellRef(row, columnID, ref allLongColumns); |
| | 0 | 985 | | } |
| | | 986 | | |
| | | 987 | | public ref ulong GetUlongRef(int row, int columnID) |
| | 0 | 988 | | { |
| | 0 | 989 | | return ref GetCellRef(row, columnID, ref allUlongColumns); |
| | 0 | 990 | | } |
| | | 991 | | |
| | | 992 | | public ref float GetFloatRef(int row, int columnID) |
| | 0 | 993 | | { |
| | 0 | 994 | | return ref GetCellRef(row, columnID, ref allFloatColumns); |
| | 0 | 995 | | } |
| | | 996 | | |
| | | 997 | | public ref double GetDoubleRef(int row, int columnID) |
| | 0 | 998 | | { |
| | 0 | 999 | | return ref GetCellRef(row, columnID, ref allDoubleColumns); |
| | 0 | 1000 | | } |
| | | 1001 | | |
| | | 1002 | | public ref Vector2 GetVector2Ref(int row, int columnID) |
| | 0 | 1003 | | { |
| | 0 | 1004 | | return ref GetCellRef(row, columnID, ref allVector2Columns); |
| | 0 | 1005 | | } |
| | | 1006 | | |
| | | 1007 | | public ref Vector3 GetVector3Ref(int row, int columnID) |
| | 0 | 1008 | | { |
| | 0 | 1009 | | return ref GetCellRef(row, columnID, ref allVector3Columns); |
| | 0 | 1010 | | } |
| | | 1011 | | |
| | | 1012 | | public ref Vector4 GetVector4Ref(int row, int columnID) |
| | 0 | 1013 | | { |
| | 0 | 1014 | | return ref GetCellRef(row, columnID, ref allVector4Columns); |
| | 0 | 1015 | | } |
| | | 1016 | | |
| | | 1017 | | public ref Vector2Int GetVector2IntRef(int row, int columnID) |
| | 0 | 1018 | | { |
| | 0 | 1019 | | return ref GetCellRef(row, columnID, ref allVector2IntColumns); |
| | 0 | 1020 | | } |
| | | 1021 | | |
| | | 1022 | | public ref Vector3Int GetVector3IntRef(int row, int columnID) |
| | 0 | 1023 | | { |
| | 0 | 1024 | | return ref GetCellRef(row, columnID, ref allVector3IntColumns); |
| | 0 | 1025 | | } |
| | | 1026 | | |
| | | 1027 | | public ref Quaternion GetQuaternionRef(int row, int columnID) |
| | 0 | 1028 | | { |
| | 0 | 1029 | | return ref GetCellRef(row, columnID, ref allQuaternionColumns); |
| | 0 | 1030 | | } |
| | | 1031 | | |
| | | 1032 | | public ref Rect GetRectRef(int row, int columnID) |
| | 0 | 1033 | | { |
| | 0 | 1034 | | return ref GetCellRef(row, columnID, ref allRectColumns); |
| | 0 | 1035 | | } |
| | | 1036 | | |
| | | 1037 | | public ref RectInt GetRectIntRef(int row, int columnID) |
| | 0 | 1038 | | { |
| | 0 | 1039 | | return ref GetCellRef(row, columnID, ref allRectIntColumns); |
| | 0 | 1040 | | } |
| | | 1041 | | |
| | | 1042 | | public ref Color GetColorRef(int row, int columnID) |
| | 0 | 1043 | | { |
| | 0 | 1044 | | return ref GetCellRef(row, columnID, ref allColorColumns); |
| | 0 | 1045 | | } |
| | | 1046 | | |
| | | 1047 | | public ref LayerMask GetLayerMaskRef(int row, int columnID) |
| | 0 | 1048 | | { |
| | 0 | 1049 | | return ref GetCellRef(row, columnID, ref allLayerMaskColumns); |
| | 0 | 1050 | | } |
| | | 1051 | | |
| | | 1052 | | public ref Bounds GetBoundsRef(int row, int columnID) |
| | 0 | 1053 | | { |
| | 0 | 1054 | | return ref GetCellRef(row, columnID, ref allBoundsColumns); |
| | 0 | 1055 | | } |
| | | 1056 | | |
| | | 1057 | | public ref BoundsInt GetBoundsIntRef(int row, int columnID) |
| | 0 | 1058 | | { |
| | 0 | 1059 | | return ref GetCellRef(row, columnID, ref allBoundsIntColumns); |
| | 0 | 1060 | | } |
| | | 1061 | | |
| | | 1062 | | public ref Hash128 GetHash128Ref(int row, int columnID) |
| | 0 | 1063 | | { |
| | 0 | 1064 | | return ref GetCellRef(row, columnID, ref allHash128Columns); |
| | 0 | 1065 | | } |
| | | 1066 | | |
| | | 1067 | | public ref Gradient GetGradientRef(int row, int columnID) |
| | 0 | 1068 | | { |
| | 0 | 1069 | | return ref GetCellRef(row, columnID, ref allGradientColumns); |
| | 0 | 1070 | | } |
| | | 1071 | | |
| | | 1072 | | public ref AnimationCurve GetAnimationCurveRef(int row, int columnID) |
| | 0 | 1073 | | { |
| | 0 | 1074 | | return ref GetCellRef(row, columnID, ref allAnimationCurveColumns); |
| | 0 | 1075 | | } |
| | | 1076 | | |
| | | 1077 | | public ref UnityEngine.Object GetObjectRef(int row, int columnID) |
| | 0 | 1078 | | { |
| | 0 | 1079 | | return ref GetCellRef(row, columnID, ref allObjectRefColumns); |
| | 0 | 1080 | | } |
| | | 1081 | | |
| | | 1082 | | // Get Column |
| | | 1083 | | |
| | | 1084 | | public string[] GetStringColumn(int columnID) |
| | 0 | 1085 | | { |
| | 0 | 1086 | | return GetColumn(columnID, ref allStringColumns); |
| | 0 | 1087 | | } |
| | | 1088 | | |
| | | 1089 | | public bool[] GetBoolColumn(int columnID) |
| | 0 | 1090 | | { |
| | 0 | 1091 | | return GetColumn(columnID, ref allBoolColumns); |
| | 0 | 1092 | | } |
| | | 1093 | | |
| | | 1094 | | public char[] GetCharColumn(int columnID) |
| | 0 | 1095 | | { |
| | 0 | 1096 | | return GetColumn(columnID, ref allCharColumns); |
| | 0 | 1097 | | } |
| | | 1098 | | |
| | | 1099 | | public sbyte[] GetSbyteColumn(int columnID) |
| | 0 | 1100 | | { |
| | 0 | 1101 | | return GetColumn(columnID, ref allSbyteColumns); |
| | 0 | 1102 | | } |
| | | 1103 | | |
| | | 1104 | | public byte[] GetByteColumn(int columnID) |
| | 0 | 1105 | | { |
| | 0 | 1106 | | return GetColumn(columnID, ref allByteColumns); |
| | 0 | 1107 | | } |
| | | 1108 | | |
| | | 1109 | | public short[] GetShortColumn(int columnID) |
| | 0 | 1110 | | { |
| | 0 | 1111 | | return GetColumn(columnID, ref allShortColumns); |
| | 0 | 1112 | | } |
| | | 1113 | | |
| | | 1114 | | public ushort[] GetUshortColumn(int columnID) |
| | 0 | 1115 | | { |
| | 0 | 1116 | | return GetColumn(columnID, ref allUshortColumns); |
| | 0 | 1117 | | } |
| | | 1118 | | |
| | | 1119 | | public int[] GetIntColumn(int columnID) |
| | 0 | 1120 | | { |
| | 0 | 1121 | | return GetColumn(columnID, ref allIntColumns); |
| | 0 | 1122 | | } |
| | | 1123 | | |
| | | 1124 | | public uint[] GetUintColumn(int columnID) |
| | 0 | 1125 | | { |
| | 0 | 1126 | | return GetColumn(columnID, ref allUintColumns); |
| | 0 | 1127 | | } |
| | | 1128 | | |
| | | 1129 | | public long[] GetLongColumn(int columnID) |
| | 0 | 1130 | | { |
| | 0 | 1131 | | return GetColumn(columnID, ref allLongColumns); |
| | 0 | 1132 | | } |
| | | 1133 | | |
| | | 1134 | | public ulong[] GetUlongColumn(int columnID) |
| | 0 | 1135 | | { |
| | 0 | 1136 | | return GetColumn(columnID, ref allUlongColumns); |
| | 0 | 1137 | | } |
| | | 1138 | | |
| | | 1139 | | public float[] GetFloatColumn(int columnID) |
| | 0 | 1140 | | { |
| | 0 | 1141 | | return GetColumn(columnID, ref allFloatColumns); |
| | 0 | 1142 | | } |
| | | 1143 | | |
| | | 1144 | | public double[] GetDoubleColumn(int columnID) |
| | 0 | 1145 | | { |
| | 0 | 1146 | | return GetColumn(columnID, ref allDoubleColumns); |
| | 0 | 1147 | | } |
| | | 1148 | | |
| | | 1149 | | public Vector2[] GetVector2Column(int columnID) |
| | 0 | 1150 | | { |
| | 0 | 1151 | | return GetColumn(columnID, ref allVector2Columns); |
| | 0 | 1152 | | } |
| | | 1153 | | |
| | | 1154 | | public Vector3[] GetVector3Column(int columnID) |
| | 0 | 1155 | | { |
| | 0 | 1156 | | return GetColumn(columnID, ref allVector3Columns); |
| | 0 | 1157 | | } |
| | | 1158 | | |
| | | 1159 | | public Vector4[] GetVector4Column(int columnID) |
| | 0 | 1160 | | { |
| | 0 | 1161 | | return GetColumn(columnID, ref allVector4Columns); |
| | 0 | 1162 | | } |
| | | 1163 | | |
| | | 1164 | | public Vector2Int[] GetVector2IntColumn(int columnID) |
| | 0 | 1165 | | { |
| | 0 | 1166 | | return GetColumn(columnID, ref allVector2IntColumns); |
| | 0 | 1167 | | } |
| | | 1168 | | |
| | | 1169 | | public Vector3Int[] GetVector3IntColumn(int columnID) |
| | 0 | 1170 | | { |
| | 0 | 1171 | | return GetColumn(columnID, ref allVector3IntColumns); |
| | 0 | 1172 | | } |
| | | 1173 | | |
| | | 1174 | | public Quaternion[] GetQuaternionColumn(int columnID) |
| | 0 | 1175 | | { |
| | 0 | 1176 | | return GetColumn(columnID, ref allQuaternionColumns); |
| | 0 | 1177 | | } |
| | | 1178 | | |
| | | 1179 | | public Rect[] GetRectColumn(int columnID) |
| | 0 | 1180 | | { |
| | 0 | 1181 | | return GetColumn(columnID, ref allRectColumns); |
| | 0 | 1182 | | } |
| | | 1183 | | |
| | | 1184 | | public RectInt[] GetRectIntColumn(int columnID) |
| | 0 | 1185 | | { |
| | 0 | 1186 | | return GetColumn(columnID, ref allRectIntColumns); |
| | 0 | 1187 | | } |
| | | 1188 | | |
| | | 1189 | | public Color[] GetColorColumn(int columnID) |
| | 0 | 1190 | | { |
| | 0 | 1191 | | return GetColumn(columnID, ref allColorColumns); |
| | 0 | 1192 | | } |
| | | 1193 | | |
| | | 1194 | | public LayerMask[] GetLayerMaskColumn(int columnID) |
| | 0 | 1195 | | { |
| | 0 | 1196 | | return GetColumn(columnID, ref allLayerMaskColumns); |
| | 0 | 1197 | | } |
| | | 1198 | | |
| | | 1199 | | public Bounds[] GetBoundsColumn(int columnID) |
| | 0 | 1200 | | { |
| | 0 | 1201 | | return GetColumn(columnID, ref allBoundsColumns); |
| | 0 | 1202 | | } |
| | | 1203 | | |
| | | 1204 | | public BoundsInt[] GetBoundsIntColumn(int columnID) |
| | 0 | 1205 | | { |
| | 0 | 1206 | | return GetColumn(columnID, ref allBoundsIntColumns); |
| | 0 | 1207 | | } |
| | | 1208 | | |
| | | 1209 | | public Hash128[] GetHash128Column(int columnID) |
| | 0 | 1210 | | { |
| | 0 | 1211 | | return GetColumn(columnID, ref allHash128Columns); |
| | 0 | 1212 | | } |
| | | 1213 | | |
| | | 1214 | | public Gradient[] GetGradientColumn(int columnID) |
| | 0 | 1215 | | { |
| | 0 | 1216 | | return GetColumn(columnID, ref allGradientColumns); |
| | 0 | 1217 | | } |
| | | 1218 | | |
| | | 1219 | | public AnimationCurve[] GetAnimationCurveColumn(int columnID) |
| | 0 | 1220 | | { |
| | 0 | 1221 | | return GetColumn(columnID, ref allAnimationCurveColumns); |
| | 0 | 1222 | | } |
| | | 1223 | | |
| | | 1224 | | public UnityEngine.Object[] GetObjectColumn(int columnID) |
| | 0 | 1225 | | { |
| | 0 | 1226 | | return GetColumn(columnID, ref allObjectRefColumns); |
| | 0 | 1227 | | } |
| | | 1228 | | |
| | | 1229 | | // Internal |
| | | 1230 | | |
| | | 1231 | | internal int AddColumnInternal<T>(string columnName, ref T[][] allColumnsOfType, ColumnType typeIndex, int inser |
| | 0 | 1232 | | { |
| | 0 | 1233 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1234 | | Array.Resize(ref allColumnsOfType, columnCount + 1); |
| | 0 | 1235 | | allColumnsOfType[columnCount] = new T[rowCount]; |
| | | 1236 | | |
| | 0 | 1237 | | string[] columnNamesForType = allColumnNames[(int)typeIndex]; |
| | 0 | 1238 | | int columnNamesCount = columnNamesForType?.Length ?? 0; |
| | 0 | 1239 | | Array.Resize(ref columnNamesForType, columnNamesCount + 1); |
| | 0 | 1240 | | columnNamesForType[columnNamesCount] = columnName; |
| | 0 | 1241 | | allColumnNames[(int)typeIndex] = columnNamesForType; |
| | | 1242 | | |
| | 0 | 1243 | | int columnIndex = columnEntriesFreeListHead; |
| | 0 | 1244 | | int columnIDToDenseIndexMapLength = columnIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 1245 | | if (columnIndex >= columnIDToDenseIndexMapLength) |
| | 0 | 1246 | | { |
| | 0 | 1247 | | Array.Resize(ref columnIDToDenseIndexMap, columnIndex * 2); |
| | 0 | 1248 | | for (int i = 0; i < columnIndex; i++) |
| | 0 | 1249 | | { |
| | 0 | 1250 | | ref ColumnEntryInternal entryInternal = ref columnIDToDenseIndexMap[columnIndex + i]; |
| | 0 | 1251 | | entryInternal.columnDenseIndex = columnIndex + i + 1; |
| | 0 | 1252 | | entryInternal.columnType = ColumnType.Invalid; |
| | 0 | 1253 | | } |
| | 0 | 1254 | | } |
| | | 1255 | | |
| | 0 | 1256 | | ref int[] denseIndexToIDMap = ref columnDenseIndexToIDMap[(int)typeIndex]; |
| | 0 | 1257 | | int denseIndexToIDMapLength = denseIndexToIDMap?.Length ?? 0; |
| | 0 | 1258 | | Array.Resize(ref denseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 1259 | | denseIndexToIDMap[denseIndexToIDMapLength] = columnIndex; |
| | | 1260 | | |
| | 0 | 1261 | | ref ColumnEntryInternal newEntryInternal = ref columnIDToDenseIndexMap[columnIndex]; |
| | 0 | 1262 | | newEntryInternal.columnDenseIndex = denseIndexToIDMapLength; |
| | 0 | 1263 | | newEntryInternal.columnType = typeIndex; |
| | | 1264 | | |
| | 0 | 1265 | | insertAt = insertAt < 0 ? combinedColumnCount + 1 : insertAt; |
| | 0 | 1266 | | ref int[] columnOrdersOfType = ref allColumnOrders[(int)typeIndex]; |
| | 0 | 1267 | | int columnOrdersOfTypeLength = columnOrdersOfType?.Length ?? 0; |
| | 0 | 1268 | | Array.Resize(ref columnOrdersOfType, columnOrdersOfTypeLength + 1); |
| | 0 | 1269 | | columnOrdersOfType[columnOrdersOfTypeLength] = insertAt; |
| | | 1270 | | |
| | 0 | 1271 | | for (int i = 0; i < (int)ColumnType.Count; i++) |
| | 0 | 1272 | | { |
| | 0 | 1273 | | int[] columnOrdersOfTypeCurrent = allColumnOrders[i]; |
| | | 1274 | | |
| | 0 | 1275 | | int columnOrdersLength = columnOrdersOfTypeCurrent.Length; |
| | 0 | 1276 | | for (int j = 0; j < columnOrdersLength; j++) |
| | 0 | 1277 | | { |
| | 0 | 1278 | | int columnOrderCurrent = columnOrdersOfTypeCurrent[j]; |
| | | 1279 | | |
| | 0 | 1280 | | if (columnOrderCurrent > insertAt) |
| | 0 | 1281 | | { |
| | 0 | 1282 | | columnOrdersOfType[j] = columnOrderCurrent + 1; |
| | 0 | 1283 | | } |
| | 0 | 1284 | | } |
| | 0 | 1285 | | } |
| | | 1286 | | |
| | 0 | 1287 | | ++combinedColumnCount; |
| | 0 | 1288 | | dataVersion++; |
| | | 1289 | | |
| | 0 | 1290 | | return columnIndex; |
| | 0 | 1291 | | } |
| | | 1292 | | |
| | | 1293 | | internal void RemoveColumnInternal<T>(ref T[][] allColumnsOfType, ColumnType typeIndex, int columnID) |
| | 0 | 1294 | | { |
| | 0 | 1295 | | int columnLocation = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | | 1296 | | |
| | 0 | 1297 | | int lastIndex = allColumnsOfType.Length - 1; |
| | 0 | 1298 | | allColumnsOfType[columnLocation] = allColumnsOfType[lastIndex]; |
| | 0 | 1299 | | T[][] newColumnArray = new T[lastIndex][]; |
| | 0 | 1300 | | Array.Copy(allColumnsOfType, 0, newColumnArray, 0, lastIndex); |
| | 0 | 1301 | | allColumnsOfType = newColumnArray; |
| | | 1302 | | |
| | 0 | 1303 | | string[] columnNamesOfType = allColumnNames[(int)typeIndex]; |
| | 0 | 1304 | | columnNamesOfType[columnLocation] = columnNamesOfType[lastIndex]; |
| | 0 | 1305 | | string[] newColumnNamesOfType = new string[lastIndex]; |
| | 0 | 1306 | | Array.Copy(columnNamesOfType, 0, newColumnNamesOfType, 0, lastIndex); |
| | 0 | 1307 | | allColumnNames[(int)typeIndex] = newColumnNamesOfType; |
| | | 1308 | | |
| | 0 | 1309 | | int[] columnOrdersOfType = allColumnOrders[(int)typeIndex]; |
| | 0 | 1310 | | int columnOrder = columnOrdersOfType[columnLocation]; |
| | 0 | 1311 | | columnOrdersOfType[columnLocation] = columnOrdersOfType[lastIndex]; |
| | 0 | 1312 | | int[] newColumnOrdersOfType = new int[lastIndex]; |
| | 0 | 1313 | | Array.Copy(columnOrdersOfType, 0, newColumnOrdersOfType, 0, lastIndex); |
| | 0 | 1314 | | allColumnOrders[(int)typeIndex] = newColumnOrdersOfType; |
| | | 1315 | | |
| | 0 | 1316 | | int[] denseIndicesOfType = columnDenseIndexToIDMap[(int)typeIndex]; |
| | 0 | 1317 | | int sparseIndexAt = denseIndicesOfType[columnLocation]; |
| | 0 | 1318 | | int sparseIndexToSwap = columnOrdersOfType[lastIndex]; |
| | 0 | 1319 | | ref ColumnEntryInternal sparseIndexToFree = ref columnIDToDenseIndexMap[sparseIndexAt]; |
| | 0 | 1320 | | sparseIndexToFree.columnType = ColumnType.Invalid; |
| | 0 | 1321 | | sparseIndexToFree.columnDenseIndex = columnEntriesFreeListHead; |
| | 0 | 1322 | | columnEntriesFreeListHead = sparseIndexAt; |
| | 0 | 1323 | | columnIDToDenseIndexMap[sparseIndexToSwap].columnDenseIndex = columnLocation; |
| | 0 | 1324 | | denseIndicesOfType[columnLocation] = sparseIndexToSwap; |
| | 0 | 1325 | | int[] newDenseIndicesOfType = new int[lastIndex]; |
| | 0 | 1326 | | Array.Copy(denseIndicesOfType, 0, newDenseIndicesOfType, 0, lastIndex); |
| | 0 | 1327 | | columnDenseIndexToIDMap[(int)typeIndex] = newDenseIndicesOfType; |
| | | 1328 | | |
| | 0 | 1329 | | for (int i = 0; i < (int)ColumnType.Count; i++) |
| | 0 | 1330 | | { |
| | 0 | 1331 | | int[] columnOrdersOfTypeCurrent = allColumnOrders[i]; |
| | | 1332 | | |
| | 0 | 1333 | | int columnOrdersLength = columnOrdersOfTypeCurrent.Length; |
| | 0 | 1334 | | for (int j = 0; j < columnOrdersLength; j++) |
| | 0 | 1335 | | { |
| | 0 | 1336 | | int columnOrderCurrent = columnOrdersOfTypeCurrent[j]; |
| | | 1337 | | |
| | 0 | 1338 | | if (columnOrderCurrent > columnOrder) |
| | 0 | 1339 | | { |
| | 0 | 1340 | | columnOrdersOfType[j] = columnOrderCurrent - 1; |
| | 0 | 1341 | | } |
| | 0 | 1342 | | } |
| | 0 | 1343 | | } |
| | | 1344 | | |
| | 0 | 1345 | | --combinedColumnCount; |
| | 0 | 1346 | | dataVersion++; |
| | 0 | 1347 | | } |
| | | 1348 | | |
| | | 1349 | | internal void InsertRowsOfTypeInternal<T>(ref T[][] allColumnsOfType, int insertAt, int numberOfNewRows) |
| | 0 | 1350 | | { |
| | 0 | 1351 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1352 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1353 | | { |
| | 0 | 1354 | | ref T[] column = ref allColumnsOfType[i]; |
| | 0 | 1355 | | int newRowCount = rowCount + numberOfNewRows; |
| | 0 | 1356 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1357 | | for (int j = newRowCount - 1; j > insertAt + numberOfNewRows - 1; j--) |
| | 0 | 1358 | | { |
| | 0 | 1359 | | column[j] = column[j - numberOfNewRows]; |
| | 0 | 1360 | | } |
| | | 1361 | | |
| | 0 | 1362 | | for (int j = 0; j < numberOfNewRows; j++) |
| | 0 | 1363 | | { |
| | 0 | 1364 | | column[insertAt + i] = default; |
| | 0 | 1365 | | } |
| | 0 | 1366 | | } |
| | 0 | 1367 | | } |
| | | 1368 | | |
| | | 1369 | | internal void DeleteRowsOfTypeInternal<T>(ref T[][] allColumnsOfType, int removeAt, int numberOfRowsToDelete) |
| | 0 | 1370 | | { |
| | 0 | 1371 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | | 1372 | | |
| | 0 | 1373 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1374 | | { |
| | 0 | 1375 | | ref T[] column = ref allColumnsOfType[i]; |
| | 0 | 1376 | | int newRowCount = rowCount - numberOfRowsToDelete; |
| | | 1377 | | |
| | 0 | 1378 | | for (int j = removeAt; j < rowCount - numberOfRowsToDelete; j++) |
| | 0 | 1379 | | { |
| | 0 | 1380 | | column[j] = column[j + numberOfRowsToDelete]; |
| | 0 | 1381 | | } |
| | | 1382 | | |
| | 0 | 1383 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1384 | | } |
| | 0 | 1385 | | } |
| | | 1386 | | |
| | | 1387 | | internal ref T GetCellRef<T>(int row, int columnID, ref T[][] allColumnsOfType) |
| | 0 | 1388 | | { |
| | 0 | 1389 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1390 | | return ref allColumnsOfType[column][row]; |
| | 0 | 1391 | | } |
| | | 1392 | | |
| | | 1393 | | internal T GetCell<T>(int row, int columnID, ref T[][] allColumnsOfType) |
| | 0 | 1394 | | { |
| | 0 | 1395 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1396 | | return allColumnsOfType[column][row]; |
| | 0 | 1397 | | } |
| | | 1398 | | |
| | | 1399 | | internal void SetCell<T>(int row, int columnID, ref T[][] allColumnsOfType, T value) |
| | 0 | 1400 | | { |
| | 0 | 1401 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1402 | | allColumnsOfType[column][row] = value; |
| | 0 | 1403 | | dataVersion++; |
| | 0 | 1404 | | } |
| | | 1405 | | |
| | | 1406 | | internal T[] GetColumn<T>(int columnID, ref T[][] allColumnsOfType) |
| | 0 | 1407 | | { |
| | 0 | 1408 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1409 | | return allColumnsOfType[column]; |
| | 0 | 1410 | | } |
| | | 1411 | | } |
| | | 1412 | | } |